/*
 * Ganesa Copyright (C) 2008 Wim Crols <twimpiex@gnx.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package be.gnx.ganesa.application.model;

public class Cuboid {

  private Coordinate bottomLeftCoordinate;

  private Coordinate topRightCoordinate;

  public Cuboid(Coordinate bottomLeftCoordinate, Coordinate topRightCoordinate) {
    this.bottomLeftCoordinate = new Coordinate(bottomLeftCoordinate);
    this.topRightCoordinate = new Coordinate(topRightCoordinate);
  }

  public Cuboid(Coordinate bottomLeftCoordinate, double height, double width, double depth) {
    this (bottomLeftCoordinate, new Coordinate(bottomLeftCoordinate.getLatitude() + height, bottomLeftCoordinate.getLongitude() + width, bottomLeftCoordinate.getElevation() + depth));
  }

  public Cuboid(double latitude, double longitude, double elevation, double height, double width, double depth) {
    this(new Coordinate(latitude, longitude, elevation), height, width, depth);
  }

  public Coordinate getBottomLeftCoordinate() {
    return bottomLeftCoordinate;
  }

  public Coordinate getTopRightCoordinate() {
    return topRightCoordinate;
  }

  public double getWidth() {
    return topRightCoordinate.getLongitude() - bottomLeftCoordinate.getLongitude();
  }

  public double getHeight() {
    return topRightCoordinate.getLatitude() - bottomLeftCoordinate.getLatitude();
  }

  public double getDepth() {
    return topRightCoordinate.getElevation() - bottomLeftCoordinate.getElevation();
  }

}
